import Storage from './storage'

export default {
  setToken(token: string, type: 'auth' | 'refresh') {
    const field = type == 'auth' ? 'token' : 'refresh_token'
    this[field] = token
    Storage.set(field, token)
  },
  getToken(type: 'auth' | 'refresh' = 'auth') {
    return type === 'auth' ? Storage.get('token') : Storage.get('refresh_token')
  }
}